<html>
<head>
<title>Applet codebase location updated after redirect</title>
<script type="text/javascript" src="/shared/scripts/testcase.js"></script>
<script type="text/javascript" src="/shared/scripts/misc.js"></script>
<script type="text/javascript">
if (window.addEventListener) {
	window.addEventListener('load', f, false);
} else if (window.attachEvent) {
	window.attachEvent('onload', f);
} else {
	window.onload = f;
}

function insert_elements(xhr, tc) {
	// NOTE: applet class path resolution is silly so these won't really load...
	//var insert_head = document.getElementsByTagName('head')[0];
	var insert_body = document.getElementById('id1');
	var redirect = "/redirect?loc=http://victim.com/shared/resources/";
	
	// applet element (codebase attrib)
	var applett_cb = new tElement("applet", "applettest_codebase");
	applett_cb.orig_loc = redirect+"TestApplet.class";
	var applet_attribs = new Array("id", applett_cb.dom_id,
								   "codebase", applett_cb.orig_loc,
								   "code", "");
	applett_cb.loc_attrib = "codebase";
	applett_cb.dom_loc = insert_body;
	applett_cb.insertAttributes(applet_attribs);
	applett_cb.insertToDOM();
	
	var tobjs = new Array(applett_cb);
						 
	// give enough time for the applets/elements to load... (see misc.js)
	setTimeout( (function() { get_loc_results_cb(tc, tobjs); }), 5000);
}

function f() {
	var tc = new TestCase();
	tc.input = 'applet\'s codebase attribute';
	tc.description = 'Test if applet codebase location has been updated after a redirect';
	tc.expected_result = 'not updated';
	tc.test_passed = 'true';
	tc.savePreTest(insert_elements);
	
}

</script>
</head>
<body>
<div id="id1"></div>
</body>
</html>